<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org" class='clearfix'>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-type-edit" th:object="${type}">
            <input id="typeId" name="typeId" th:field="*{typeId}"  type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">显示顺序：</label>
                <div class="col-sm-8">
                    <input id="typeSort" name="typeSort" th:field="*{typeSort}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">分类名称：</label>
                <div class="col-sm-8">
                    <input id="typeName" name="typeName" th:field="*{typeName}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">所属餐别：</label>
                <div  class="radio-box"  th:each="dict : ${type.dishTypeItemList}">
                    <input type="checkbox"   th:text="${dict.typeName}"  name="belongTypes"  th:value="${dict.typeId}"
                           th:checked="${dict.ifSelected}"
                    />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">排餐菜数：</label>
                <div class="col-sm-8">
                    <input id="typeNums" name="typeNums" class="form-control" type="text" placeholder="如素菜，每餐排5个，就填写5"
                    th:field="*{typeNums}"
                    >
                </div>
            </div>

            <div class="form-group">	
                <label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">

				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
				</div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "dailymenu/dishtype"
		$("#form-type-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-type-edit').serialize());
			}
		});
		
		// h所有修改，光标默认定位在第1个输入框
		var oldVal=$('input:eq(1)').val();
		$('input:eq(1)').val("").focus().val(oldVal);
		// h弹框自适应高度
		function isScrollY(addition) {
// 			如果没有滚动条
		   	if(!(document.documentElement.scrollHeight > document.documentElement.clientHeight)){
		   		var alertHeight = document.querySelector("form").clientHeight+addition
				window.parent.$('.layui-layer-iframe').height(alertHeight)
				window.parent.$('iframe').height(alertHeight)
		   	}
		}
		isScrollY(70)
	</script>
</body>
</html>
